package com.nts.visionworks.business.contents.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * ContentsMedia generated by hbm2java
 */
@Entity
@Table(name = "contents_media", catalog = "visionworks")
public class ContentsMedia implements java.io.Serializable
{

	private Long mediaId;
	private long archiveId;
	private String mediaDetails;
	private Set<ContentsMediaThumbnail> contentsMediaThumbnails = new HashSet<ContentsMediaThumbnail>(
			0);
	private Set<ContentsElement> contentsElements = new HashSet<ContentsElement>(
			0);

	public ContentsMedia()
	{
	}

	public ContentsMedia(long archiveId)
	{
		this.archiveId = archiveId;
	}

	public ContentsMedia(long archiveId, String mediaDetails,
			Set<ContentsMediaThumbnail> contentsMediaThumbnails,
			Set<ContentsElement> contentsElements)
	{
		this.archiveId = archiveId;
		this.mediaDetails = mediaDetails;
		this.contentsMediaThumbnails = contentsMediaThumbnails;
		this.contentsElements = contentsElements;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "MediaId", unique = true, nullable = false)
	public Long getMediaId()
	{
		return this.mediaId;
	}

	public void setMediaId(Long mediaId)
	{
		this.mediaId = mediaId;
	}

	@NotNull(message = "validation.contents.contentsMedia.archiveId.notNull")
	@Column(name = "ArchiveId", nullable = false)
	public long getArchiveId()
	{
		return this.archiveId;
	}

	public void setArchiveId(long archiveId)
	{
		this.archiveId = archiveId;
	}

	@Max(message = "validation.contents.contentsMedia.mediaDetails.max", value = 200)
	@Column(name = "MediaDetails", length = 200)
	public String getMediaDetails()
	{
		return this.mediaDetails;
	}

	public void setMediaDetails(String mediaDetails)
	{
		this.mediaDetails = mediaDetails;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "contentsMedia")
	public Set<ContentsMediaThumbnail> getContentsMediaThumbnails()
	{
		return this.contentsMediaThumbnails;
	}

	public void setContentsMediaThumbnails(
			Set<ContentsMediaThumbnail> contentsMediaThumbnails)
	{
		this.contentsMediaThumbnails = contentsMediaThumbnails;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "contents_element_media", catalog = "visionworks", joinColumns =
	{ @JoinColumn(name = "MediaId", nullable = false, updatable = false) }, inverseJoinColumns =
	{ @JoinColumn(name = "ContentsElementId", nullable = false, updatable = false) })
	public Set<ContentsElement> getContentsElements()
	{
		return this.contentsElements;
	}

	public void setContentsElements(Set<ContentsElement> contentsElements)
	{
		this.contentsElements = contentsElements;
	}

}
